package com.future.service;

import java.util.Date;
import java.util.List;

import com.future.common.exception.AppException;
import com.future.dao.MettingDao;
import com.future.dao.MettingPersonsDao;
import com.future.model.Metting;
import com.future.model.MettingPersons;
import com.future.model.Records;
import com.jfinal.aop.Inject;

public class MettingService {
	@Inject
	private MettingDao mettingDao;
	@Inject
	private MettingPersonsDao mettingPersonsDao;
	@Inject
	private Metting metting;
	public List<Metting> getMettingList(String sfsh) {
		return mettingDao.getMettingList(sfsh);
	}
	public Metting getMettingDetail(String mettingid) {
		Metting metting = this.metting.findById(mettingid);
		List<MettingPersons> mettinPersonsList = this.mettingPersonsDao.getMettingPersons(mettingid);
		metting.put("mettinPersonsList", mettinPersonsList);
		return metting;
	}
	public void mettingsh(String mettingid) {
		Metting metting = this.metting.findById(mettingid);
		if(metting.getSfsh()!=null && "1".equals(metting.getSfsh())){
			throw new AppException("该会议已经审核!");
		}
		metting.setSfsh("1");
		metting.update();
	}
	public List<Metting> getMyMeetingList(String type,String userId) {
		return mettingDao.getMyMeetingList(type,userId);
	}
	public List<Records> getMessages(String mettingid, Date fromdate) {
		return mettingDao.getMessages(mettingid,fromdate);
	}
	
}
